Out[7]:
<Axes: xlabel='alcohol', ylabel='total'>
In [ ]:
Inference: The scatterplot helps visualize the relationship between alcohol involvement and total crashes.
In [8]:
sns.histplot(x="total",bins=20, kde=True,data=df) Out[8]:
<Axes: xlabel='total', ylabel='Count'>
In [ ]:
Inference:The histplot allows you to draw the following inferences about the distribution of total crashes
In [9]:
sns.boxplot(df) Out[9]:
>
<Axes:
In [ ]:
Inference: This boxplot helps visualize the relationship between all columns and their p rices.
In [10]:
sns.countplot(x="abbrev",data=df) Out[10]:
<Axes: xlabel='abbrev', ylabel='count'>
In [ ]:
Inference:In this countplot we can see that relation between states and count of crashes occured in each state.
In [11]:
sns.jointplot(x="alcohol",y="speeding",data=df) Out[11]:
90>
<seaborn.axisgrid.JointGrid at 0x233c8e8dd
In [ ]:
Inference:The joint plot above displays the relationship between the "alcohol" and "speed ing" variables.
In [12]:
sns.relplot(x="alcohol",y="speeding",data=df,height=6,hue="speeding") Out[12]:
<seaborn.axisgrid.FacetGrid at 0x233c922edd0>
In [ ]:
Inference:The relplot allows us to visually assess the relationship between alcohol invo lvement and speeding involvement in car crashes
In [13]:
sns.lineplot(x="abbrev",y="total",data=df,marker="o") Out[13]:
<Axes: xlabel='abbrev', ylabel='total'>
In [ ]:
Inference:The plot visualizes how the total number of crashes varies from one state to a nother state.
In [14]:
>
sns.barplot(x="abbrev",y="total",data=df) Out[14]:
<Axes: xlabel='abbrev', ylabel='total'
In [ ]:
Inference:The bar plot shows the average total crashes by state.
In [22]:
corr=df.corr() corr
C:\Users\murra\AppData\Local\Temp\ipykernel_27992\1661191605.py:1: FutureWarning: The def ault value of numeric_only in DataFrame.corr is deprecated. In a future version, it will default to False. Select only valid columns or specify the value of numeric_only to silen ce this warning.
corr=df.corr() Out[22]:
In [23]:
sns.heatmap(corr,annot=True) Out[23]:
>
<Axes:
In [ ]:
Inference:
Darker colors indicate stronger correlations, while lighter colors indicate weaker or no correlations.
The diagonal of the heatmap is always 1 because it represents the correlation of a va riable with itself (perfect correlation).
In [ ]:
In [ ]:
In [ ]: